package com.ldu.exam.model;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Builder
@Table(name="t_exam")
public class ExamModel 
{
	@Id
	@Column(length=32)
	@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "jpa-uuid")
	@GenericGenerator(name = "jpa-uuid",strategy = "uuid.hex")
	private String id ;
	
	/**
	 * 名称
	 */
	private String name;
	
	private String examTime;
	
	/**
	 * 参加人数
	 */
	private String joinNum;
	
	/**
	 * 参加的人的集合
	 */
	@OneToMany
	private Set<ClaModel> ExamClas;
	
	/**
	 * 试卷集合
	 */
	
	@ManyToOne
    @JoinColumn(name="paperId")
	@JsonIgnoreProperties("created")
	private TestPaperModel paper;
	
	/**
	 * 创建时间
	 */
	@CreationTimestamp
	private Timestamp creationDate ;
	
	/**
	 * 修改时间
	 */
	@UpdateTimestamp
	private Timestamp updateDate ;
	
}
